


# idf_component_register(SRCS "fatfs_getting_started_main.c"
#                     PRIV_REQUIRES vfs fatfs
#                     INCLUDE_DIRS ".")

set(COMPONENT_SRCS 
    # "readFile.c"
    # "spiflash_example.c"
    # "spiflash_list_files.c"
    # "check_format_status.c"
    "read_embedded_files_fat_spiffs.c"
)   

idf_component_register(SRCS "${COMPONENT_SRCS}"
                    # PRIV_REQUIRES vfs fatfs
                    INCLUDE_DIRS "."
                    # EMBED_TXTFILES "spiflash/example.txt"
                    REQUIRES vfs spiffs fatfs
                    )



# 在设备上，文件路径取决于您的挂载点配置。从项目代码可以看到：
# 如果使用FATFS，挂载点为/spiflash，所以文件路径为/spiflash/test.txt
# 如果使用SPIFFS，挂载点通常为/spiffs，文件路径为/spiffs/test.txt

# 启用FATFS镜像生成
fatfs_create_spiflash_image(storage data FLASH_IN_PROJECT)
# fatfs_create_spiflash_image(storage data FLASH_IN_PROJECT FATFS_LABEL="storage")
# fatfs_create_spiflash_image(storage data FLASH_IN_PROJECT FATFS_LABEL="storage" --partition_size 0x100000)
# 或对于SPIFFS
# spiffs_create_partition_image(storage data FLASH_IN_PROJECT)

# 将文件 /spiffs/test.txt 上传到设备的 spiffs_partition 分区
# spiffs_create_partition_image(storage data FATFS_LABEL="storage")
spiffs_create_partition_image(spiffs_partition spiflash FLASH_IN_PROJECT)